package com.zhu.designpatterns.creational.builder;

/**
 * @author ZhuXinYe
 * @date 2022/8/29 22:31
 * @description 具体建造者：描述具体建造者，并实现抽象建造者公共接口。
 **/
public class ConcreteBuilder extends Builder {

    private Car car;

    public ConcreteBuilder() {
        car = new Car();
    }

    /**
     * 造引擎
     */
    @Override
    void buildEngine() {
        car.setEngine("Engine.");
    }

    /**
     * 造车门
     */
    @Override
    void buildDoor() {
        car.setDoor("Door");
    }

    /**
     * 造车窗
     */
    @Override
    void buildWindow() {
        car.setWindow("Window");
    }

    /**
     * 造车轮
     */
    @Override
    void buildWheel() {
        car.setWheel("Wheel");
    }

    /**
     * 完工
     *
     * @return Car
     */
    @Override
    Car getCar() {
        return car;
    }
}
